<template>
  <div id="app">
    <!--    <SquareLakeFlow/>-->
    <!--    <ProcessManager/>-->

    <nav>
      <div class="left">
        <div v-if="isLogin">
          <el-menu
              :default-active="activeIndex"
              class="el-menu-demo"
              :router="true"
              mode="horizontal"
          >
            <el-menu-item index="/">流程管理</el-menu-item>
            <!--            <el-sub-menu index="2">-->
            <!--              <template #title>Workspace</template>-->
            <!--              <el-menu-item index="2-1">item one</el-menu-item>-->
            <!--              <el-menu-item index="2-2">item two</el-menu-item>-->
            <!--              <el-menu-item index="2-3">item three</el-menu-item>-->
            <!--              <el-sub-menu index="2-4">-->
            <!--                <template #title>item four</template>-->
            <!--                <el-menu-item index="2-4-1">item one</el-menu-item>-->
            <!--                <el-menu-item index="2-4-2">item two</el-menu-item>-->
            <!--                <el-menu-item index="2-4-3">item three</el-menu-item>-->
            <!--              </el-sub-menu>-->
            <!--            </el-sub-menu>-->
            <!--            <el-menu-item index="3" disabled>Info</el-menu-item>-->
            <el-menu-item index="/comp">组件市场</el-menu-item>
            <el-menu-item index="/thread">线程配置</el-menu-item>
            <el-menu-item index="/datasource">数据库配置</el-menu-item>
            <el-menu-item index="/restApi">rest服务</el-menu-item>
            <el-menu-item index="/job">任务调度</el-menu-item>
            <el-menu-item index="/process/runner">运行时流程</el-menu-item>
          </el-menu>
        </div>
      </div>

    </nav>
    <router-view/>
  </div>
</template>

<script>
// import SquareLakeFlow from './components/SquareLakeFlow.vue'
// import ProcessManager from './components/process/ProcessManager.vue'
import SqLogin from "@/views/login/SqLogin.vue";
import {useStore} from 'vuex';

export default {
  name: 'App',
  data() {
    return {
      activeIndex: "/"
    }
  },
  components: {
    // SquareLakeFlow,
    // ProcessManager
  },
  computed: {
    isLogin() {
      const store = useStore();
      return store.state.userInfo.isLogin
    }
  },
  created() {
    const store = useStore();
    const dd = store.state.userInfo.isLogin;
    if (!dd) {
      this.$router.push({
        name: "login"
      });
    }
  },
  mounted() {
    var test = window.location.pathname;
    if (test) {
      this.activeIndex = test;
    }
  },
  methods: {}
  // computed(){
  //   this.$router.push("home")
  // }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  /*margin-top: 60px;*/
}
</style>
